# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=davtest
pkgver=3.a282c58
pkgrel=5
groups=('blackarch' 'blackarch-scanner')
pkgdesc="Tests WebDAV enabled servers by uploading test executable files, and then (optionally) uploading files which allow for command execution or other actions directly on the target."
url='http://code.google.com/p/davtest/'
license=('GPL')
arch=('any')
depends=('perl' 'perl-http-dav')
makedepends=('git')
#source=("http://davtest.googlecode.com/files/$pkgname-$pkgver.tar.bz2")
source=("git+https://github.com/orielg/$pkgname.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  cp --no-preserve=ownership -a davtest.pl README.txt tests backdoors \
    "$pkgdir/usr/share/$pkgname/"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec perl $pkgname.pl "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

